import init from '@feidao/web/framework/browser/d/component';
import { id, spaceid, systemid, refsystemid } from './config';
import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import fire from '@feidao/web/atom/browser/msg/fire';
import set_user from '@feidao/web/atom/browser/storage/put';

import a001 from './a001';

import s from './s';
const actions = {
	a001,

	async user_loginout(fd: IFeidaoAiBrowserComponent, ...args: any[]) {

		await set_user('user', '');
		window.location.href = 'login.html';
	},
	async update_pwd(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
		await fire('zjc-000006', 'cmpt_show');
	},
	async select_role(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
		await fire('zjc-000005', 'cmpt_show');
	}
};

export default function main(url: string, query: any) {

	return init(id, s, actions, url, query, { spaceid, systemid, refsystemid });
}
